How Do I Localize Built-In Editors?

The following editors contain English-language content which you may want to localize.

Date Editor

For date display, the editor uses the ambient language. This can be set using the xml:lang attribute or the FrameworkElement.Language property. (You will usually set these at a window level rather than directly on the grid.)

To localize the content displayed on the “Today” button, create a resource with the key Calendar.TodayButtonContentKey. This is typically a string: for example:

CopyLocalizing the Today button
<sys:String x:Key='{x:Static ms:MonthCalendar.TodayButtonContentKey}'>Aujourd'hui</sys:String>

(For this, you will need to declare an XML namespace for the System namespace in the mscorlib assembly.)

Color Editor

This editor does not support localization because it gets the list of color names from the WPF Colors class, and this does not provide localized forms. If you need to localize this control, you will need to create a custom template.

Multiple Values

To localize the content displayed on the “Reset” button, create a resource with the key ManyEditor.ResetButtonContentKey. Similarly, to localize the tooltip for this button, create a resource with the key ManyEditor.ResetButtonToolTipKey.

CopyLocalizing the Reset button tooltip
<sys:String x:Key='{x:Static ms:ManyEditor.ResetToolTipContentKey}'>Inconsistent values.  Click to reset.</sys:String>

To localize the text displayed in the body of the multiple-values display, create a DataTemplate resource with the key ManyEditor.InconsistentValuesTemplateKey. Your template will receive an instance of Many if you wish to display dynamic content.